package metalink.admin;
import com.opensymphony.xwork2.ActionSupport;

import java.util.*;
import java.sql.*;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import vo.*;
import vo.mixed.*;
import model.admin.*;
import myutil.*;


public class EventsMenu extends ActionSupport{
	int myeventscount=0;
	public int getMyeventscount() {
		return myeventscount;
	}
	public void setMyeventscount(int myeventscount) {
		this.myeventscount = myeventscount;
	}
	public int getIncomingeventscount() {
		return incomingeventscount;
	}
	public void setIncomingeventscount(int incomingeventscount) {
		this.incomingeventscount = incomingeventscount;
	}
	int incomingeventscount=0;
public String execute(){
	try {
		HttpSession session = ServletActionContext.getRequest().getSession();
		String username = session.getAttribute("username").toString();
		Connect c=new Connect();
		ResultSet rs=c.getResult("select count(*) as myeventscount from event_details where event_creator_id='"+username+"'");
		while(rs.next()){
			myeventscount=rs.getInt("myeventscount");
		}
		rs=c.getResult("select count(*) as incomingeventscount from event_participation where participant_id='"+username+"'");
		while(rs.next()){
		incomingeventscount=rs.getInt("incomingeventscount");
		}
		
		return SUCCESS;
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return ERROR;
	}
}
}
